package StudentPackage;


import java.util.ArrayList;
import junit.framework.TestCase;
import moreHealthModel.Campus.FoodSources.*;
import moreHealthModel.Campus.LearningEnvironment.*;
import moreHealthModel.Campus.Residences.Residence1;
import moreHealthModel.Campus.Transit.*;
import moreHealthModel.Student.*;
import moreHealthModel.Student.Student.Disease;


public class testStudentJourney extends TestCase
	{
		StudentJourney sj;
		StudentJourney sj1;
		StudentJourney sj2;
		StudentJourney sj3;
		StudentJourney sj4;
		StudentJourney sj5;
		StudentJourney sj6;
		ArrayList<StudentJourney> testArray = new ArrayList<StudentJourney>();

		public void setUp() throws Exception
			{
				    sj = new StudentJourney();
				    sj1= new StudentJourney();
				    sj2= new StudentJourney();
				    sj3= new StudentJourney();
				    sj4 = new StudentJourney();
				    sj6 = new StudentJourney();
				    
				    //The assignment required Test case.
					sj.setStudentVisitedPlaces(new Halls(0,0,"HallTest1",701));
					sj.setStudentVisitedPlaces(new FastFood(0,1,"FastFoodTest2",702));
					sj.setStudentVisitedPlaces(new Restaurant(0,2,"RestaurantTest1",703));
					sj.setStudentVisitedPlaces(new Residence1(0,3,"ResidenceTest2",704));
					sj.setStudentVisitedPlaces(new Sidewalk(0,4,705));
					sj.setStudentVisitedPlaces(new Library(4,1,"LibTest2",706));
					sj.setStudentVisitedPlaces(new ClassRoom(4,2,"ClassRoomTest1",707));
					sj.setStudentVisitedPlaces(new Halls(4,3,"HallTest2",708));
					sj.setStudentVisitedPlaces(new Sidewalk(4,4,709));
					sj.setStudentVisitedPlaces(new Sidewalk(3,3,710));
					sj.setStudentVisitedPlaces(new Halls(2,2,"HallTest1",711));
					
					//Normal cases
					sj1.setStudentVisitedPlaces(new Halls(0,1,"Hall1",710));
					sj1.setStudentVisitedPlaces(new FastFood(0,2,"Fast2",711));
					sj1.setStudentVisitedPlaces(new Sidewalk(0,3,712));
					
					//Extreme Case
					sj1.setStudentVisitedPlaces(new Halls(0, -1, "123",-999));

					
				
			}

		
		public void testTotalDistanceCalculator()
			{
				//Normal case
				System.out.println("Start Testing for object sj:");
				assertEquals(2.17,sj.TotalDistanceCalculator(sj.getStudentVisitedPlaces()));
				System.out.println("End Testing for object sj:");
				
				//Extreme Case
				System.out.println("Start Testing for object sj1:");
				assertEquals(0.4,sj1.TotalDistanceCalculator(sj1.getStudentVisitedPlaces()));
				System.out.println("End Testing for object sj1:");

			}

		public void testsetStudentInfo()
			{
				//Normal Case
				//Student Info is set.
				Student s1= new Student("Aloke", 24, 4, 160, Disease.other);
				sj.setStudentInfo(s1);
				assertEquals(s1,sj.currentStudentx_);
				assertSame(s1,sj.currentStudentx_);
				assertEquals(false, sj.currentStudentx_.getstudentInfoStatus());
				
				//Corner Case
				//The Student Information is not set. 
				Student s2=null;
				sj1.setStudentInfo(s2);
				assertNull(sj1.currentStudentx_);
				
				//Random Case
				Student s3= new Student (null, -9,-9,-6,Disease.heartTrouble);
				sj3.setStudentInfo(s3);
				assertNotNull(sj3);
				assertEquals(true, sj3.currentStudentx_.getstudentInfoStatus());
			}

		public void testsetStudentVisitedPlaces()
			{	
				//Random
				sj6.setStudentVisitedPlaces(null);
				assertEquals(true, sj6.getStudentVisitedPlaces().isEmpty());
			}
		
		public void testgetStudentVisitedPlaces()
			{
				//Normal Case.
				assertEquals(false, sj.getStudentVisitedPlaces().isEmpty());
				assertEquals(11, sj.getStudentVisitedPlaces().size());
				
				//Random Case: There is not information about the Student's journey
				assertTrue(sj2.getStudentVisitedPlaces().isEmpty());

			}
		
		public void tearDown() throws Exception
			{
			}

	}
